package com.chaosj.tools.rules

import com.chaosj.tools.StockDiscoverTools

/**
 * 昨天降了,今天高开异动
 */
class LastDayDownButBldUpRule implements IAbnormalRule{

    @Override
    boolean execute(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        for (int i = stocks.size()-1; i >= 0; i -- ){
            if( stocks.get(i).upDownFlag() == StockDiscoverTools.ResultEnum.UP && stocks.get(i-1).upDownFlag()== StockDiscoverTools.ResultEnum.DOWN ){
                println(description(stockName))
                return true
            }
            break
        }
        return false
    }

    @Override
    boolean support(String stockName, List<StockDiscoverTools.DescriptionStock> stocks) {
        return stocks.size()>=2
    }

    @Override
    String description(Object... stockName) {
        return String.format("【%s】昨天跌了,今天高开.请注意是否为抢手票",stockName)
    }
}
